Bentley Map V8i (SELECTseries 10) Help

Exporting Data in MapInfo® MIF/MID Files

To export data, write a script file describing which data to export. This script uses the standard scripting functions to filter the data to export. The data is written to the MapInfo® MIF file, which must be opened by the script command OUTPUT. The output file must start with some header information. How this header information should look varies from layer to layer. A good way to find out how the header information should look is to use the MapInfo® function “Table > Export” on an existing table and examine the resulting MapInfo® MIF file header. Copy the header information and use the PRINT command to write the contents to the MapInfo® MIF file. Besides the writing of the header, an ordinary script must be written. The VALIDATE part of this script contains two commands, a MapInfo® MIF command writing the graphics to the MapInfo® MIF file, and a MID command writing the corresponding attribute values to the MapInfo® MID file. The first time the MID command is used, the script automatically opens a MapInfo® MID file with the same filename as the MapInfo® MIF file but the extension .MID.

The following example shows a script, writing a map of the states to the MapInfo® MIF/MID format. The map contains a number of shapes, linked to the table states, found in Access.

Column name

Datatype

mslink

integer

mapid

integer

state

char(2)

statename

char(20)

motto

char(254)

birdname

char(25)



The MIF ELEMENT command writes the graphic element to the MapInfo® MIF file, using a layout (color, line style, etc.) as similar as possible to the MicroStation element. The MIF command can be used with the same syntax as the PLACE command (described in section 3.6.1).

For example, use the command MIF TEXT . . ., to create a text element in the MIF file for each element processed by the script.

Use the PRINT command to write any information to the MapInfo® MIF file. Using the MIF command, design the complete content of the MapInfo® MIF file, or add extra information overruling the information already written.

The MID command is used to write the attribute values from the SQL database to the MapInfo® MID file. Remember to have one line in the MapInfo® MID file for each graphic element in the MapInfo® MIF file. The syntax of the MID command is:

MID variable [, variable [, variable, . . .]]

The character used to separate the variable names (in this example, a comma) must match the character defined in the MapInfo® MIF file using the command Delimiter. The variable must have a datatype matching the definitions in the MIF header. The number of variables in the MID line must match the number found in the MIF header in the line starting with the word Columns.